#lofterCrawlerPanel {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 250px;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-radius: 4px;
  z-index: 2147483647;
  padding: 10px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  display: block !important;
  visibility: visible !important;
}

.panel-content {
  background: #fff;
  border-radius: 4px;
}

.button-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.button-group button {
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 4px;
  background: #ff6b00;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.button-group button:hover {
  background: #ff5500;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button-group button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* 爬取按钮激活状态 */
.button-group button.crawling {
  animation: crawling-pulse 2s infinite;
  pointer-events: none;
}

/* 爬取按钮激活时的微光动画 */
@keyframes crawling-pulse {
  0% {
    background: #ff6b00;
  }
  50% {
    background: #ff8533;
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.5);
  }
  100% {
    background: #ff6b00;
  }
}

.status-info {
  margin: 10px 0;
  padding: 8px;
  background: #f8f8f8;
  border-radius: 4px;
  font-size: 12px;
  transition: background-color 0.3s ease;
}

.status-info p {
  margin: 4px 0;
  color: #666;
}

/* 爬取完成状态 */
.status-info.completed {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
}

.status-info.completed p {
  color: #2e7d32;
}

/* 最小化按钮样式 */
.minimize-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #666;
}

/* 最小化状态 */
#lofterCrawlerPanel.minimized {
  width: auto;
  padding: 8px;
}

#lofterCrawlerPanel.minimized .panel-content {
  display: none;
}

/* 拖动手柄 */
.drag-handle {
  cursor: move;
  padding: 4px;
  margin-bottom: 8px;
  color: #666;
  font-weight: bold;
}

#lofterCrawlerPanel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

#lofterCrawlerPanel .panel-header h3 {
  margin: 0;
  font-size: 16px;
}

/* 对话框基础样式 */
.dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2147483646;
}

/* 普通对话框内容样式 */
.dialog-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  min-width: 300px;
  max-width: 500px;
  position: relative;
}

/* 图片查看器专用对话框内容样式 */
.dialog-content.large {
  padding: 0;
  min-width: unset;
  max-width: unset;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: white;
  position: relative;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
}

.form-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.form-group textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
}

.form-group textarea:focus {
  border-color: #ff6b00;
  outline: none;
}

.dialog-buttons {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

#addTemplate {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

#addTemplate:hover {
  background: #45a049;
}

.template-item {
  border: 1px solid #ddd;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.template-item:hover {
  background: #f5f5f5;
}

.template-item.selected {
  border-color: #ff6b00;
  background: #fff3e6;
}

.template-info h4 {
  margin: 0 0 5px 0;
}

.template-info p {
  margin: 3px 0;
  font-size: 12px;
  color: #666;
}

.template-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.template-actions button {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  background: #fff;
}

.template-actions .edit-btn {
  color: #2196F3;
  border-color: #2196F3;
}

.template-actions .edit-btn:hover {
  background: #e3f2fd;
}

.template-actions .copy-btn {
  color: #4CAF50;
  border-color: #4CAF50;
}

.template-actions .copy-btn:hover {
  background: #e8f5e9;
}

.template-actions .delete-btn {
  color: #f44336;
  border-color: #f44336;
}

.template-actions .delete-btn:hover {
  background: #ffebee;
}

.input-rows {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  gap: 8px;
}

.input-field {
  display: flex;
  align-items: center;
}

.input-field label {
  white-space: nowrap;
  width: 100px;
  flex-shrink: 0;
}

.input-field input {
  width: 80px;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.current-template {
  margin: 10px 0;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
}

.current-template h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #333;
}

#templateInfo {
  font-size: 12px;
  color: #666;
}

#templateInfo p {
  margin: 4px 0;
}

#templateInfo.no-match {
  color: #ff6b00;
  font-style: italic;
}

.page-range {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-range input {
  width: 45px;
  padding: 4px;
  text-align: center;
}

.page-range span {
  margin: 0 2px;
  color: #666;
}

.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.switch-template-btn {
  padding: 4px 8px;
  font-size: 12px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.switch-template-btn:hover {
  background: #e0e0e0;
}

.input-help {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  line-height: 1.4;
}

.form-group input[type="text"]#templateFilenamePrefix {
  width: 100%;
  padding: 6px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.form-group label[for="templateFilenamePrefix"] {
  display: block;
  margin-bottom: 4px;
  color: #666;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 24px;
  padding: 16px;
  height: calc(90vh - 140px); /* 减去头部和底部的高度 */
  overflow: hidden;
  background: #f5f5f5;
  margin: 0 auto;
  width: 98%;
}

.image-item {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-item:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.image-item.selected {
  border-color: #ff6b00;
}

.image-item.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: #ff6b00;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.viewer-controls-container {
  background: white;
  border-top: 1px solid #eee;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.select-controls {
  display: flex;
  gap: 12px;
}

.viewer-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pagination-info {
  color: #666;
  font-size: 14px;
  margin-right: 16px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #ddd;
  background: white;
  color: #666;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button.active {
  background: #ff6b00;
  color: white;
  border-color: #ff6b00;
}

.image-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2147483647;
  display: none;
  justify-content: center;
  align-items: center;
}

.image-preview-modal img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

/* 统一的按钮样式 */
.viewer-controls button {
  padding: 4px 12px;
  border: none;
  border-radius: 4px;
  background: #ff6b00;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  min-width: 80px;
  max-width: 80px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-controls button:hover {
  background: #ff5500;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.viewer-controls button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* 下载按钮特殊样式 */
#downloadSelected {
  background: #4CAF50;
}

#downloadSelected:hover {
  background: #45a049;
}

/* Toast样式 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: #333;
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 2147483648;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-info {
  background: #2196F3;
}

.toast-success {
  background: #4CAF50;
}

.toast-error {
  background: #F44336;
}

.toast-warning {
  background: #FF9800;
}

/* 图片查看器对话框样式 */
#imageViewerDialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  height: 90vh;
  background: white;
  z-index: 2147483647;
  display: none;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 对话框标题栏 */
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: white;
  border-bottom: 1px solid #eee;
  height: 36px;
  min-height: 36px;
}

.dialog-header h3 {
  margin: 0;
  font-size: 16px;
  color: #333;
}

/* 关闭按钮 */
.close-dialog {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: #666;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.close-dialog:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #ff6b00;
}

/* 页码信息样式 */
.page-info {
  margin-left: 8px;
  color: #666;
  font-size: 14px;
}

/* 耗时统计样式 */
.time-stats {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #eee;
}

.time-stats p {
  color: #666;
  font-size: 12px;
  margin: 4px 0;
}

/* 按钮基础样式 */
.viewer-button {
  padding: 6px 16px;
  border: 1px solid #ddd;
  background: white;
  color: #666;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
}

.viewer-button:hover {
  border-color: #ff6b00;
  color: #ff6b00;
}

.viewer-button.active {
  background: #ff6b00;
  color: white;
  border-color: #ff6b00;
}

/* 下载按钮特殊样式 */
.viewer-button.download {
  background: #ff6b00;
  color: white;
  border-color: #ff6b00;
}

.viewer-button.download:hover {
  background: #ff5500;
}

/* 选中计数器 */
.selection-counter {
  color: #666;
  font-size: 14px;
  white-space: nowrap;
  padding: 0 12px;
  border-left: 1px solid #ddd;
  display: flex;
  align-items: center;
  height: 36px;
}

/* 主要内容区域 */
.viewer-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 左侧按钮组 */
.controls-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 右侧分页区域 */
.controls-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 按钮禁用状态 */
.button-group button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* 单行按钮 */
.button-group button.full-width {
  grid-column: 1 / -1;
}

/* 关闭按钮 */
.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  padding: 5px 10px;
  background: none;
  border: none;
  font-size: 16px;
  color: #666;
}

/* 确保对话框在面板之上 */
#templateDialog.active,
#editTemplateDialog.active {
  display: flex;
  z-index: 2147483648;
} 